<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% 
	String path = request.getContextPath();
%>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>我的发布</title>

    <link rel="icon" type="<%= path %>/image/png" href="assets/images/favicon-32x32.png">
    <link rel="stylesheet" href="<%= path %>/assets/main/css/fonts.css">
    <link rel="stylesheet" href="<%= path %>/assets/main/css/style.css">
    <script src="<%=path %>/js/jquery-3.6.0.min.js" type="text/javascript"></script>
</head>

<body>
    <div id="main-wrapper" class="show">

        <div class="nav-header">
            <div class="brand-logo">
                <a href="index.html"><img class="brand-title" src="<%= path %>/assets/images/logo.png" alt=""></a>
            </div>
        </div>
        <aside class="left-panel nicescroll-box">


			<nav class="navigation">
				<ul class="list-unstyled main-menu">
					<li class="has-submenu"><a
						href="${path }/MyCollectionController?action=getMyCollection">
							<i class="fas fa-th-large"></i> <span class="nav-label">我的收藏</span>
					</a></li>
					<li class="has-submenu"><a
						href="${path }/PostController?action=show"> <i
							class="fas fa-calendar-plus"></i> <span class="nav-label">我的发布</span>
					</a></li>
					<li class="has-submenu"><a
						href="${path }/UpdatePasswordController?action=changeuserpass">
							<i class="fas fa-chart-pie"></i> <span class="nav-label">修改密码</span>
					</a></li>
					<li class="has-submenu"><a
						href="${path}/UpdateUserinfoCenterController?action=UpdateUserinfoCenterById">
							<i class="fas fa-cog"></i> 修改个人信息
					</a></li>
					<li class="has-submenu"><a
						href="${path}/PostNumberLikesController?action=postNumberLikes">
							<i class="fas fa-cog"></i> 获赞
					</a></li>
					<li class="has-submenu"><a
						href="${path}/CommentReplyController?action=findAll"> <i
							class="fas fa-cog"></i> 我的帖子
					</a></li>
				</ul>
			</nav>

			<div class="sidebar-widgets">
				<div class="top-sidebar box-shadow mx-25 m-b-30 p-b-20 text-center">
					<img src="<%= path %>/assets/images/appointement.svg"
						class="side-img" alt="img">
				</div>
				<div class="copyright text-center">
					<p class="mb-0">中国航天</p>
					<p class="mb-0">© 2021</p>
				</div>
			</div>
		</aside>

        <div class="header">
            <header class="top-head container-fluid">
                <div class="nav-control">
                    <div class="hamburger">
                        <span class="line"></span><span class="line"></span><span class="line"></span>
                    </div>
                    <div class="left-header content-header__menu">
                        <ul class="list-unstyled">
                            <li></li>
                            <li></li>
                        </ul>
                    </div>
                </div>
                <div class="header-right">
                    <div class="fullscreen notification_dropdown">
                        <div class="full">
                            <a class="text-dark" href="#!" onclick="javascript:toggleFullScreen()">
                                <i class="fas fa-expand"></i>
                            </a>
                        </div>
                    </div>
                    <div class="notification_dropdown">
                        <div class="cart-wrapper">
                            <div class="cart-icon">
                                <a class="cart-control" href="#">
                                    <i class="fas fa-bell"></i>
                                    <div class="pulse-css"></div>
                                </a>
                            </div>
                            <div class="cart-dropdown-form dropdown-container">
                                <div class="form-content">
                                    <div class="widget-media main-scroll nicescroll-box">
                                        <ul class="timeline">
                                            <li>
                                                <h6 class="mb-0">消息中心</h6>
                                            </li>
                                            <li>
                                                <div class="timeline-panel">
                                                    <div class="media mr-2">
                                                        <img alt="image" src="<%= path %>/assets/images/avtar/1.jpg">
                                                    </div>
                                                    <div class="media-body">
                                                        <h6 class="mb-1 ">用户昵称</h6>
                                                        <small class="d-block">2021/11/9 15:00</small>
                                                    </div>
                                                </div>
                                            </li>                                      
                                        </ul>
                                    </div>
                                    <a class="all-notification btn btn-primary" href="#">
                                       
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="my-account-wrapper">
                        <div class="account-wrapper">
                            <div class="account-control">
                                <a class="login header-profile" href="#" title="Sign in">
                                    <div class="header-info">
                                        <span>用户</span>
                                        <small>李四</small>
                                    </div>
                                    <img src="<%= path %>/assets/images/2.jpeg" alt="people">
                                </a>
                                <div class="account-dropdown-form dropdown-container">
                                    <div class="form-content">
                                        <a href="page-login.html">
                                            <i class="fas fa-sign-in-alt"></i>
                                            <span class="ml-2">退出 </span>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </header>
        </div>
        <div class="content-body">
            <div class="warper container-fluid">
                <div class="new_appointment main_container">
                    <div class="row page-titles mx-0">
                        <div class="col-sm-6 p-md-0">
                            <div class="welcome-text">
                                <h4 class="text-primary">我的发布</h4>
                                <p class="mb-0">管理我的帖子</p>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6 col-xl-3 col-lg-6">
                            <div class="widget card card-primary">
                                <div class="card-body" style="background-color:#0d6efd;border-radius:5px;">
                                    <div class="media text-center">
                                        <span>
                                            <i class="fas fa-calendar-check fa-2x"></i>
                                        </span>
                                        <div class="media-body">
                                            <span class="text-white">发布帖子数量</span>
                                        <a href="<%=path %>/PostController?action=Postsave">${count }</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-12">
                            <div class="card shadow">
                                <div class="card-body">
                                    <div class="table-responsive">
                                       查看：<a href="<%=path %>/PostController?action=show">已通过审核</a>
                                       <a href="<%=path %>/PostController?action=Fail" class="audit">未通过审核</a>
                                        <table id="example3" class="display nowrap">
                                          
                                            <thead>
                                                <tr>
                                                    <th>序号</th>
                                                   	<th>标题</th>
                                                    <th>发布时间</th>
                                                    <th>状态</th>
                                                    <th>操作</th>
                                                    <th></th>
                                                    <th></th>
                                                </tr>
                                            </thead>
                                          
                                            <tbody>
                                            <c:forEach items="${posts }" var="post"  varStatus="status">
                                                <tr>                                                              
                                                    <td>${status.count }</td>
                                                    
                                                    
                                                    <td><a href="<%=path %>/PostController?action=Failposts&id=${post.id}">                            
                                        			${post.title }
                                        			</a></td>
                                                    
                                                    <td>${post.pubTime }</td>
                                                    <td class="text-start">
                                                        <span class="badge badge-primary">
                                                        ${post.ispass==true?"已通过审核":"未通过审核" }
                                                        </span>
                                                    </td>
                                                      
                                                    <td><button data-id="${post.id }" class="delete">删除</button></td>
                                                  
                                                </tr>
                                                 <tr>
                                                   
                                                   </c:forEach>
                                            </tbody>
                                        </table>
                                    </div>
                                     <c:forEach begin="1" var="i" end="${count/2+(count%2==0?0:1) }">
                                     <a  href="<%=path %>/PostController?action=show&pageNum=${i}">${i }</a>
                                    </c:forEach>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="footer">
            <div class="copyright">
                <p class="mb-0">Copyright ©&中国航天  &amp;2021 
                </p>
            </div>
        </div>

        <div class="modal fade" id="exampleModalCenter" tabindex="-1" aria-labelledby="modal-title-head-modal" aria-hidden="true">
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="modal-title-head-modal">Michael R Sheets</h5>
                        <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"> <span
                                aria-hidden="true">&times;</span>
                        </button>
                    </div>
            
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
                        <button type="button" class="btn badge-primary">Save changes</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade" id="changeTimeAndDate" tabindex="-1" role="dialog" aria-labelledby="modal-title-edit-modal">
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="modal-title-edit-modal"><img class="rounded-circle" width="35" src="<%= path %>/assets/images/patients/user1.jpg" alt=""> Michael R Sheets
                        </h5>
                        <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    </div>
                    <div class="modal-body">
                        <form class="row align-items-start">
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <input class="form-control" type="text" value="06/17/2021">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <select class="form-control form-select">
                                        
                                    </select>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
                        <button type="button" class="btn badge-primary">Save changes</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade selectRefresh" id="newAppointment" tabindex="-1" aria-labelledby="exampleModalLabelOne">
            <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabelOne"> New appointment </h5>
                        <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    </div>
                    <div class="modal-body">
                        <form class="row align-items-start">
                            <div class="col form-group">
                                <input class="form-control" type="text" value="06/17/2021">
                            </div>
                            <br>
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <label>Motif Patient</label>
                                    <textarea class="form-control" rows="3"></textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
                        <button type="button" class="btn badge-primary">Save changes</button>
                    </div>
                </div>
            </div>
        </div>


    </div>

  

    <script src="<%= path %>/assets/plugins/popper/popper.min.js"></script>

    <script src="<%= path %>/assets/plugins/bootstrap/js/bootstrap.min.js"></script>

    <script src="<%= path %>/assets/plugins/moment/moment.min.js"></script>

    <script src="<%= path %>/assets/plugins/daterangepicker/daterangepicker.min.js"></script>

    <script src="<%= path %>/assets/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<%= path %>/assets/js/init-tdatatable.js"></script>

    <script src="<%= path %>/assets/js/toggleFullScreen.js"></script>
    <script src="<%= path %>/assets/js/main.js"></script>
  
  
    
<script type="text/javascript">

        var path = "${pageContext.request.contextPath}";
		$(function(){
			$(".table-responsive").on("click",".delete",function(){
				//alert("1111111111");
				var id = $(this).data("id");
				var that = $(this);
				var url = path+"/PostController?action=delete";
				$.get(url,{id:id},function(mes){
					that.parent().parent().remove();
				});
			});
		})	
	</script>
	
	
	

</body>

</html>